package lk.icta.core.entity;

import lk.icta.common.entity.DSDivision;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author Supun Nimesh Karunathilaka
 */
@Entity
@Table(schema = "COMMON_RAIL")
@NamedQueries({
        @NamedQuery(
                name = "getLocalAuthorityForDSDivisionByDSDivisionId",
                query = "SELECT la FROM LocalAuthority la WHERE la.dsDivision.id=:divisionId AND la.mode=1"
        )
})
public class LocalAuthority implements Serializable {

    public enum Mode {
        INACTIVE, // 0 - inactive
        ACTIVE    // 1 active

    }

    /**
     * A system generated unique key
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    /**
     * The Name of the Local Authority prefix
     */
    @Column(nullable = true)
    private String siName;
    @Column(nullable = true)
    private String enName;
    @Column(nullable = true)
    private String taName;

    @ManyToOne
    @JoinColumn(nullable = false)
    private DSDivision dsDivision;

    @ManyToOne
    @JoinColumn(nullable = false)
    private LocalAuthorityType localAuthorityType;

    @Column
    private Mode mode;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getSiName() {
        return siName;
    }

    public void setSiName(String siName) {
        this.siName = siName;
    }

    public String getEnName() {
        return enName;
    }

    public void setEnName(String enName) {
        this.enName = enName;
    }

    public String getTaName() {
        return taName;
    }

    public void setTaName(String taName) {
        this.taName = taName;
    }

    public DSDivision getDsDivision() {
        return dsDivision;
    }

    public void setDsDivision(DSDivision dsDivision) {
        this.dsDivision = dsDivision;
    }

    public LocalAuthorityType getLocalAuthorityType() {
        return localAuthorityType;
    }

    public void setLocalAuthorityType(LocalAuthorityType localAuthorityType) {
        this.localAuthorityType = localAuthorityType;
    }

    public Mode getMode() {
        return mode;
    }

    public void setMode(Mode mode) {
        this.mode = mode;
    }


}
